Current Location: Home> Function Categories> hexdec

hexdec

Convert hexadecimal to decimal
Name:hexdec
Category:math
Programming Language:php
One-line Description:Convert hexadecimal to decimal.

Definition and usage

hexdec() function converts hexadecimal to decimal.

Example

 <?php
echo hexdec ( "1e" ) ;
echo hexdec ( "a" ) ;
echo hexdec ( "11ff" ) ;
echo hexdec ( "cceeff" ) ;
?>

Try it yourself

grammar

 hexdec ( hex_string )
parameter describe
hex_string Required. Specifies the hexadecimal number to be converted.

illustrate

Returns a decimal number equivalent to the hex number represented by the hex_string parameter. hexdec() converts a hex string to a decimal number. The maximum value that can be converted is 7ffffffff, that is, 2147483647 in decimal. Starting with PHP 4.1.0, this function can handle large numbers, in which case it returns the float type.

hexdec() replaces all non-hexadecimal characters encountered with 0. This way, all the left zeros are ignored, but the right zeros are counted into the value.

Similar Functions
  • Convert hexadecimal to decimal hexdec

    hexdec

    Converthexadecimalto
  • Generate better random numbers mt_rand

    mt_rand

    Generatebetterrandom
  • Cosine cos

    cos

    Cosine
  • Returns the remainder of the floating point number of division fmod

    fmod

    Returnstheremaindero
  • Round the division result intdiv

    intdiv

    Roundthedivisionresu
  • Sow the random number generator seeds srand

    srand

    Sowtherandomnumberge
  • Get the pi value pi

    pi

    Getthepivalue
  • Inverse hyperbolic sine asinh

    asinh

    Inversehyperbolicsin
Popular Articles